package com.snoob.bffAuth.controller;

import com.snoob.springcloudalibaba.base.BaseResult;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @描述：demo测试
 * @作者：lixing_java@163.com
 * @时间：2022/8/21 16:44
 */
@RestController()
@RequestMapping("demo")
@RefreshScope // 动态刷新配置参数
public class DemoController {
    @Value("${test}")
    private String test;
    @GetMapping("loadBalance")
    public BaseResult<String> loadBalance() {
        return new BaseResult<String>().success(test);
    }

    @GetMapping("requestRateLimiter1/test1")
    public BaseResult<String> requestRateLimiter1_test1() {
        return new BaseResult<String>().success("requestRateLimiter1");
    }

    @GetMapping("requestRateLimiter2/test1")
    public BaseResult<String> requestRateLimiter2_test1() {
        return new BaseResult<String>().success("requestRateLimiter2-test1");
    }

    @GetMapping("requestRateLimiter2/test2")
    public BaseResult<String> requestRateLimiter2_test2() {
        return new BaseResult<String>().success("requestRateLimiter2-test2");
    }
}
